<template>
  <div :class="!darkSkin ? 'comment' : 'comment dark'">
    <div class="title">评论(1000)</div>
    <div class="comment_item">
      <div class="user_avatar">
        <img
          src="https://img1.baidu.com/it/u=2029513305,2137933177&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=472"
          alt="用户头像"
        />
      </div>
      <div class="detail">
        <div class="user_name">skygray:</div>
        <div class="user_comment">这一整部电影都比不上这首歌</div>
        <div class="subsidiary">
          <div class="comment_time">2022年1月29日 21:01</div>
          <div :class="!darkSkin ? 'operate' : 'operate dark'">
            <ul>
              <li>
                <i class="iconfont icon-dianzan"></i>
                <span>275</span>
              </li>
              <li>
                <i class="iconfont icon-pinglun"></i>
                <span>75</span>
              </li>
            </ul>
          </div>
        </div>
        <div class="openMore" v-if="open && !allComments" @click="showMore">
          <span>展开更多</span>
        </div>
        <div class="closeMore" v-if="open && allComments" @click="hideMore">
          <span>合并评论</span>
        </div>
      </div>
    </div>
    <div v-if="allComments">
      <div :class="!darkSkin ? 'comment_item_item' : 'comment_item_item dark'">
        <div class="user_avatar">
          <img
            src="https://img1.baidu.com/it/u=2029513305,2137933177&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=472"
            alt="用户头像"
          />
        </div>
        <div class="detail">
          <div class="user_name">skygray:</div>
          <div class="user_comment">啊对对对对</div>
          <div class="subsidiary">
            <div class="comment_time">2022年1月29日 21:01</div>
            <div :class="!darkSkin ? 'operate' : 'operate dark'">
              <ul>
                <li>
                  <i class="iconfont icon-dianzan"></i>
                  <span>275</span>
                </li>
                <li>
                  <i class="iconfont icon-pinglun"></i>
                  <span>75</span>
                </li>
              </ul>
            </div>
          </div>
        </div>
      </div>
      <SmallPagination />
    </div>
  </div>
</template>

<script>
import SmallPagination from "./SmallPagination.vue";
export default {
  name: "Comment",
  components: {
    SmallPagination,
  },
  data() {
    return {
      open: true,
      allComments: false,
    };
  },
  computed: {
    darkSkin() {
      return this.$store.state.darkSkin;
    },
  },
  methods: {
    //触发获取评论详细
    showMore() {
      this.allComments = true;
    },
    //合并评论
    hideMore() {
      this.allComments = false;
    },
  },
};
</script>

<style scoped>
* {
  box-sizing: border-box;
  list-style: none;
}
@media screen and (min-width: 1439.98px) {
  .comment {
    position: relative;
    margin: 15px auto;
    width: 80%;
    padding: 0px 40px;
    border-top: 1px solid rgba(30, 35, 42, 0.3);
    /* box-shadow: 0 4px 10px 10px rgb(0 0 0 / 5%); */
    transition: all 0.8s ease;
  }
  .comment_item {
    display: flex;
    width: 100%;
    height: 160px;
    padding: 20px 40px;
    align-items: center;
  }
  .user_avatar {
    width: 50px;
    height: 50px;
    line-height: 130px;
    border-radius: 50%;
  }
  .user_avatar img {
    display: block;
    width: 50px;
    height: 50px;
    border-radius: 50%;
  }
  .comment_item_item {
    display: flex;
    position: relative;
    width: 85%;
    height: 90px;
    margin: 15px auto;
    padding: 5px 40px;
    align-items: center;
    transition: all 0.8s ease;
  }
}
@media screen and (min-width: 1024px) and (max-width: 1439.98px) {
  .comment {
    position: relative;
    margin: 15px auto;
    width: 90%;
    padding: 0px 20px;
    border-top: 1px solid rgba(30, 35, 42, 0.3);
    transition: all 0.8s ease;
  }
  .comment_item {
    display: flex;
    width: 100%;
    height: 160px;
    padding: 20px 40px;
    align-items: center;
  }
  .user_avatar {
    width: 50px;
    height: 50px;
    line-height: 130px;
    border-radius: 50%;
  }
  .user_avatar img {
    display: block;
    width: 50px;
    height: 50px;
    border-radius: 50%;
  }
  .comment_item_item {
    display: flex;
    position: relative;
    width: 85%;
    height: 90px;
    margin: 15px auto;
    padding: 5px 20px;
    align-items: center;
    transition: all 0.8s ease;
  }
}
@media screen and (min-width: 768px) and (max-width: 1023.98px) {
  .comment {
    position: relative;
    margin: 15px auto;
    width: 90%;
    padding: 0px 10px;
    border-top: 1px solid rgba(30, 35, 42, 0.3);
    transition: all 0.8s ease;
  }
  .comment_item {
    display: flex;
    width: 100%;
    height: 160px;
    padding: 20px 40px;
    align-items: center;
  }
  .user_avatar {
    width: 50px;
    height: 50px;
    line-height: 130px;
    border-radius: 50%;
  }
  .user_avatar img {
    display: block;
    width: 50px;
    height: 50px;
    border-radius: 50%;
  }
  .comment_item_item {
    display: flex;
    position: relative;
    width: 85%;
    height: 90px;
    margin: 15px auto;
    padding: 5px 40px;
    align-items: center;
    transition: all 0.8s ease;
  }
}
@media screen and (max-width: 767.98px) {
  .comment {
    position: relative;
    margin: 15px auto;
    width: 100%;
    padding: 0px 3px;
    border-top: 1px solid rgba(30, 35, 42, 0.3);
    transition: all 0.8s ease;
  }
  .title {
    padding: 0 30px;
  }
  .comment_item {
    display: flex;
    width: 100%;
    height: 150px;
    padding: 20px 25px;
    align-items: center;
  }
  .user_avatar {
    width: 30px;
    height: 30px;
    line-height: 130px;
    border-radius: 50%;
  }
  .user_avatar img {
    display: block;
    width: 30px;
    height: 30px;
    border-radius: 50%;
  }
  .comment_item_item {
    display: flex;
    position: relative;
    width: 85%;
    height: 90px;
    margin: 15px auto;
    padding: 5px 5px;
    align-items: center;
    transition: all 0.8s ease;
  }
}
.comment.dark {
  border-top: 1px solid #a9a9b3;
}
.comment::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 90%;
  transform: translate(-50%, 0);
  border-bottom: 1px solid rgba(30, 35, 42, 0.15);
}
.title {
  margin-top: 5px;
  width: 100%;
  font-size: 1.5rem;
}
.detail {
  display: flex;
  width: 100%;
  height: 100%;
  padding: 0 15px;
  flex-direction: column;
  justify-content: space-between;
}
.user_name {
  display: flex;
  width: 100%;
  height: 30%;
  font-size: 1.3rem;
  color: #2980b9;
  align-items: center;
}

.user_comment {
  display: flex;
  width: 100%;
  height: 30%;
  font-size: 1rem;
  align-items: center;
}
.subsidiary {
  display: flex;
  width: 100%;
  height: 30%;
  justify-content: space-between;
  align-items: center;
}
.comment_time {
  width: 50%;
  font-size: 0.7rem;
  color: #909399;
}
.openMore,
.closeMore {
  position: relative;
  width: 80px;
  text-align: center;
  align-self: center;
}
.openMore span,
.closeMore span {
  font-size: 0.9rem;
}
.openMore::before {
  content: ">";
  position: absolute;
  width: 100%;
  height: 30px;
  bottom: -25px;
  left: 50%;
  transform: translate(-55%, 0) rotate(90deg);
}
.closeMore::before {
  content: ">";
  position: absolute;
  width: 100%;
  height: 30px;
  bottom: -25px;
  left: 50%;
  transform: translate(-45%, 0) rotate(-90deg);
}
.openMore,
.closeMore:hover {
  cursor: pointer;
  color: #2980b9;
}

.operate {
  width: 35%;
}
.operate ul {
  display: flex;
  width: 100%;
  flex-direction: row;
}
.operate li {
  position: relative;
  width: 50%;
  max-width: 90px;
  height: 100%;
  text-align: center;
  color: #606266;
}
.operate.dark li {
  color: #a9a9b3;
}
.operate li > span,
i {
  font-size: 0.9rem;
}
.operate li:hover {
  cursor: pointer;
  color: #000000;
}
.operate.dark li:hover {
  color: #ffffff;
}
.operate li:nth-child(1)::before {
  content: "";
  position: absolute;
  top: 0;
  right: -5%;
  height: 100%;
  border-right: 1px solid #bec1c7;
}
.operate span {
  margin-left: 5px;
}
.comment_item_item::before {
  content: "";
  position: absolute;
  top: -10%;
  left: 50%;
  transform: translate(-50%, 0);
  width: 100%;
  border-top: 1px solid rgba(30, 35, 42, 0.3);
}
.comment_item_item.dark::before {
  border-top: 1px solid #a9a9b3;
}
.comment_item_item .user_avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
}
.comment_item_item .user_avatar img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
}
.comment_item_item .detail {
  display: flex;
  width: 100%;
  height: 100%;
  padding: 0 15px;
  flex-direction: column;
  justify-content: space-between;
}
.comment_item_item .user_name {
  width: 100%;
  font-size: 0.9rem;
}
.comment_item_item .user_comment {
  width: 100%;
  font-size: 0.9rem;
}
/* .comment_item_item .user_comment */
</style>